package net.helix.ui.interactive.keyboard;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public abstract class KeyboardHelper implements KeyListener {
	private static final int LENGTH = 128; 
	
	public boolean[] keys;
	public long[] keysWhen;
	public long[] keysReleased;
	
	public KeyboardHelper(){
		keys = new boolean[LENGTH];
		keysWhen = new long[LENGTH];
		keysReleased = new long[LENGTH];
	}
	@Override
	public void keyPressed(KeyEvent e) {
		int code = e.getKeyCode();
		if(code < keys.length){
			keys[code] = true;
			keysWhen[code] = e.getWhen();
		}
		
	}

	@Override
	public void keyReleased(KeyEvent e) {
		int code = e.getKeyCode();
		if(code < keys.length){
			keys[code] = false;
			keysReleased[code] = e.getWhen();
		}
		
	}

	@Override
	public void keyTyped(KeyEvent e) {
		
		
	}

}
